import sys
import os

# locate app-engine SDK
AE_PATH = "/cygdrive/c/Program Files (x86)/Google/google_appengine/"
#AE_PATH = "/usr/local/google_appengine/"

# path to app code
APP_PATH = os.path.abspath(".")

# load the AE paths (as stolen from dev_appserver.py)
EXTRA_PATHS = [
    APP_PATH,
    AE_PATH,
    os.path.join(AE_PATH, 'lib', 'antlr3'),
    os.path.join(AE_PATH, 'lib', 'django'),
    os.path.join(AE_PATH, 'lib', 'ipaddr'),
    os.path.join(AE_PATH, 'lib', 'webob'),
    os.path.join(AE_PATH, 'lib', 'yaml', 'lib'),
    os.path.join(AE_PATH, 'lib', 'fancy_urllib'), # issue[1]
]
sys.path = EXTRA_PATHS + sys.path

import unittest
from google.appengine.api import memcache
from google.appengine.ext import db
from google.appengine.ext import testbed

from datetime import *
from time import *
import random 

from engine.Person import *
from mobileCom import *

class T(unittest.TestCase):

    def setUp(self):
        # First, create an instance of the Testbed class.
        self.testbed = testbed.Testbed()
        # Then activate the testbed, which prepares the service stubs for use.
        self.testbed.activate()
        # Next, declare which service stubs you want to use.
        self.testbed.init_datastore_v3_stub()
        self.testbed.init_memcache_stub()

        # Create test person
        p = Person()
        p.lastName = "Clausen"
        p.email = "thomas.the.red@gmail.com"
        p.password = "3"
        p.save()
        
    def tearDown(self):
        self.testbed.deactivate()

    def testLogin(self):
        print performLogin("thomas.the.red@gmail.com", "3")

    def testGetCheckIns(self):
        a1 = Activity(name="Paa arbejde")
        a1.save()
        a2 = Activity(name="Hjemme")
        a2.save()
        print getCheckIns("1", (1,1))
        
    def testGetActivity(self):
        print getActivity("1")
        

if __name__ == '__main__':
    unittest.main()

